#include<iostream>
#include<cstdio>
#include<cctype>
using namespace std;

const int N = 25;
char s[N]; 

int main()
{
	int n; cin >> n;
	for (int i = 0; i < n; i++)
	{
		scanf("%s", s);
		if (islower(s[0]))
			s[0] -= 32;
		int j = 1;
		while (s[j])
		{
			if (isupper(s[j]))
			{
				s[j] += 32;
			}
			j++;
		}
		cout << s << endl; 
	}
	return 0;
}
